{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
{load href="__PLUGINS__layui/layui.js"}
{load href="__PLUGINS__layui/css/layui.css"}
<style type="text/css">
    #des,#des input{ width: 40px;text-align:center;}
    #id{ width: 78px; }
    .bs-checkbox{ width: 36px; height: 40px }
    .fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
    #title span{ float: right; }
    .asdlkjasd{ background: #1ab394; color: #fff}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('consumption')}">返回列表</a>
                                </div>{php}
                                }
                                {/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="支付方用户id">
                                </div>


                            </div>
                        </form>

                            <div class="pull-right search">
                                <div class="columns columns-right btn-group pull-left" >
                                  <select class="form-control" id="search">
                                    <option value="0">一个月内在线</option>
                                    <option value="1">三个月内在线</option>
                                    <option value="2">六个月内在线</option>
                                    <option value="3">不限时间</option>
                                  </select>
                                </div>
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" onclick="refresh()" class="btn btn-default btn-outline">重新检索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text" id="rate" placeholder="最低消费占比">
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text" id="topup" placeholder="最低充值总额">
                                </div>


                            </div>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center">id</th>
                                    <th data-align="center">支付方</th>
                                    <th data-align="center">对方</th>
                                    <th data-align="center">总充值</th>
                                    <th data-align="center">亲密度</th>
                                    <th data-align="center">消费占比</th>
                                    <!-- <th data-align="center">关联ID</th> -->
                                    <th data-align="center">管理</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                    <td>{$v.id}</td>
                                    <td>
                                        <a onClick="add('{:url('member/index',['search'=>'id','name'=>$v['user_id']])}')" style="color:#40BCF7">{:getname($v.user_id)}</a> <br > ({$v.user_id}) ({$v.last_login_datetime})
                                    </td>
                                    <td>
                                        <a onClick="add('{:url('member/index',['search'=>'id','name'=>$v['touser']])}')" style="color:#40BCF7">{:getname($v.touser)}</a> <br > ({$v.touser}) ({$v.touser_last_login_datetime})
                                    </td>
                                    <td>{$v.topup}</td>
                                    <td>{$v.intimate}</td>
                                    <td>{$v.rate}%</td>
                                    <!-- <td>{$v.user_ids}</td> -->
                                    <td>
                                        <a onclick="chat('{$v.user_id},{$v.touser}')" style="color:#40BCF7">查看对话</a>

                                        <div class="btn-group">
                                            <div onClick="add('{:url('member/addLimitDating',['user_id'=>$v['user_id'],'url'=>-1])}')" class="btn btn-danger btn-xs dropdown-toggle">添加相亲限制
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript">

    $(document).ready(function(){
        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })
    });


    function refresh() {
        let topup = $('#topup').val()
        let rate = $('#rate').val()
        let search = $('#search').val()
        var Tip = layer.load(1, {
            shadeClose: false,
            title: '检索中..',
            shade: [0.8,'#fff'] //0.1透明度的白色背景
        });

        $.ajax({
            type: 'POST',
            url: "{:url('admin/tool/consumption')}",
            data: {topup,rate, search},
            dataType: 'json',
            success: function (date) {
                if (date.state) {
                    layer.msg(date.msg, {icon: 1});
                    window.location.reload();
                } else {
                    layer.close(Tip);
                    layer.msg(date.msg, {icon: 0});
                }
            },
            error: function (e) {
                layer.close(Tip);
                layer.msg(e.responseText);
            }
        });
    }
    function chat(uids)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("usertalk/records")}?search=userid&d=1&name='+uids
            });
        });
    }
</script>
